import { TextEdit } from "std-widgets.slint";
import { Callabler } from "callabler.slint";
import { Translations } from "translations.slint";
import { PopupBase } from "popup_base.slint";
import { GuiState } from "gui_state.slint";

export component PopupNewDirectories inherits Rectangle {
    out property <length> popup_width: 350px;
    out property <length> popup_height: 200px;
    callback show_popup();

    property <bool> included_directories;
    private property <string> text_data;

    popup_window := PopupBase {
        width: popup_width;
        height: popup_height;
        title_text <=> Translations.popup_new_directories_title_text;
        enabled_ok_button: text_data != "";

        VerticalLayout {
            TextEdit {
                vertical-stretch: 1.0;
                text <=> text_data;
            }
        }

        ok_clicked => {
            Callabler.added_manual_directories(GuiState.choosing_include_directories, text_data);
        }
    }

    show_popup() => {
        popup_window.show();
    }
}
